require.config({baseUrl: '/js/lib',urlArgs: "v0.0.1"});
require(['zepto', 'lib'], function($, lib) {
  var fn = {}, lib = new lib();
  $.extend(fn, {
    init: function(){
      
      this.bindEvent();
    },
    bindEvent: function(){
      $(document).on('tap', '.ui-red-botton:not(.ui-ing)', function(data){
        var _this = this, userName = $("input[name=userName]").val().trim(),
        userAccount = $("input[name=userAccount]").val().trim();
        if(!userName || !userAccount){
          lib.showMessage("请输入填写姓名或账户");
          return;
        }
        lib.onLoading();
        $(_this).addClass("ui-ing");
        lib.ajx(lib.getReq().ser + 'sellerCenter/manualBindAlipay.action', {realname: userName, alipayAccount: userAccount}, function(data){
          if(data.infocode === '0')
            location.href = './account.html';
          else{
            lib.showMessage(data.info);
            $(_this).removeClass("ui-ing");            
          } 
        }, function(){
          $(_this).removeClass("ui-ing");
          lib.showMessage("网络延时，请稍后再试");
        });
      });
    },
  });
  
  fn.init();
});